<?

class CustomDictView extends DefaultView {
	function __construct($viewname) {
		$this->columnname = preg_replace('/^custom_dict_/','',$viewname);
		$this->sql['fields'] = 'custom_dicts.value';
		$this->sql['table'] = 'custom_dicts, custom_columns';
		$this->sql['where command'] = 'where';
		$this->sql['where'] = "custom_dicts.id_custom_column = custom_columns.id_custom_column and custom_columns.custom_column_name = '" . pg_escape_string($this->columnname) ."'";
		$this->sql['order by'] = 'value';
		return parent::__construct($viewname);
	}
	function get_columns($viewname) {
		return array(array(column=>'value'));
	}
	function create_sql() {
		return implode(' ',$this->sql);
	}
}

?>
